package com.zxh.service.impl;

import com.zxh.dao.AccountDao;
import com.zxh.dao.AccountDao;
import com.zxh.pojo.Account;
import com.zxh.pojo.TransferInfo;
import com.zxh.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AccountServiceImpl implements AccountService {
    @Autowired
    private AccountDao accountDao;

    @Override
    public List<Account> findAll() {
        System.out.println("业务层-->查询所有的账户");
        List<Account> accounts = accountDao.findAll();
        return accounts;
    }

    @Override
    public void transfer(TransferInfo transferInfo){
        accountDao.updateMoney(transferInfo.getId1(),transferInfo.getMoney1());
        int a=3/0;//出现异常
        accountDao.updateMoney(transferInfo.getId2(),transferInfo.getMoney2());
    }
}
